import { Tools } from 'weaver-mobile';
import DocConstant from '../util/index';

const catchApiError = DocConstant.catchApiError;

// 获得新闻类型
export const getNewsType = params =>
    Tools.callApi({url: '/api/doc/mobile/news/getcolumn', method: 'GET', params}).then(catchApiError);
// 获得新闻列表
export const getNews = params =>
    Tools.callApi({url: '/api/doc/mobile/news/gethome', method: 'GET', params}).then(catchApiError);
// 获得新闻收藏
export const getMyCollect = params =>
    Tools.callApi({url: '/api/doc/mobile/news/favorite', method: 'GET', params}).then(catchApiError);
// 搜索新闻列表
export const searchNews = params =>
    Tools.callApi({url: '/api/doc/mobile/news/gethome', method: 'GET', params}).then(catchApiError);
//移除我的栏目tag（将所有传到后台的tag状态置0，即放到更多栏目）
export const saveMoveMoreTag = params =>
    Tools.callApi({url: '/api/doc/mobile/news/saveColumnMoreOfUser', method: 'GET', params}).then(catchApiError);
//添加我的栏目tag（将所有传到后台的tag状态置1，即放到我的栏目）
export const saveAddMyTagColumn = params =>
    Tools.callApi({url: '/api/doc/mobile/news/saveColumnOfUser', method: 'GET', params}).then(catchApiError);
//添加我的栏目tag(只对从更多到我的 的tag的状态进行更新)
export const updateAddMyTagstatus = params =>
    Tools.callApi({url: '/api/doc/mobile/news/removeColumnMore', method: 'GET', params}).then(catchApiError);
//获取搜索历史列表
export const getHistoryList = params =>
    Tools.callApi({url: '/api/networkdisk/clouddisk/getHistorySearch', method: 'GET', params}).then(catchApiError);

//清空搜索历史列表
export const clearSearchHistory = params =>
    Tools.callApi({url: '/api/networkdisk/clouddisk/clearHistory', method: 'GET', params}).then(catchApiError);

export const addHistory = params =>
    Tools.callApi({url: '/api/networkdisk/clouddisk/addHistory', method: 'GET', params}).then(catchApiError);


